#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75550-perl.sh
# Version:    1.0
# Date:       2013/11/29
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    02系统基本功能-07开发环境-01语言支持-01perl语言
# Notes:      perl语言
# Copyright:  China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/11/29
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh
source ../../lib/XmlParse.sh


function CleanData ()
{
  rm -rf hello.pl
  rm -rf hello.sh
  EchoInfo "75550-perl.sh执行完毕"
}

trap "CleanData" EXIT INT

#屏幕直接输出
EchoInfo "直接使用perl命令，屏幕直接输出"
perl -e 'print "hello world!\n"' &> /tmp/tmp1
test "`cat /tmp/tmp1`" == "hello world!"
EchoResult "直接使用perl命令正确"

#执行perl文件
EchoInfo "执行perl文件"
echo "print 'hello world!\n'" >hello.pl
[ "`perl hello.pl`" == "hello world!\n" ]
EchoResult "执行.perl文件成功"

#执行shell文件
EchoInfo "执行shell文件"
echo "#!/usr/bin" >hello.sh
echo "print 'hello world!\n'" >>hello.sh
[ "`perl hello.sh`" != "hello world!" ]
EchoResult "执行.sh文件失败"

